<?php

use think\migration\Migrator;

class AlterCouponProductChannelSome extends Migrator
{
    public function up()
    {
        $sql = <<<SQL
        ALTER TABLE `coupon_product_channel` ADD COLUMN  `image` varchar (255)  NOT NULL DEFAULT '' COMMENT  '商品图片';
        ALTER TABLE `coupon_product_channel` ADD COLUMN  `brand_id` int(11)  NOT NULL DEFAULT 0 COMMENT  '品牌id';
        ALTER TABLE `coupon_product_channel` ADD COLUMN  `sku_type` tinyint(1)  NOT NULL DEFAULT 0 COMMENT  '货源商品类型 0 未分类 1 卡券商品 2 直充商品';
        ALTER TABLE `coupon_product_channel` ADD COLUMN  `relate_state` tinyint(1) NOT NULL DEFAULT 0   COMMENT  '关联状态 0未关联 1已关联 2匹配失败';
        ALTER TABLE `coupon_product_channel` ADD COLUMN  `shelf_state` tinyint(1) NOT NULL DEFAULT -1 COMMENT  '上下架状态 -1未知状态 0 下架 1上架';
        ALTER TABLE `coupon_product_channel` ADD COLUMN  `deleted_at` timestamp COMMENT  '删除标识';
SQL;
        $this->execute($sql);
    }

    public function down()
    {
        $this->table('coupon_product_channel')->removeColumn('image');
        $this->table('coupon_product_channel')->removeColumn('brand_id');
        $this->table('coupon_product_channel')->removeColumn('sku_type');
        $this->table('coupon_product_channel')->removeColumn('relate_state');
        $this->table('coupon_product_channel')->removeColumn('shelf_state');
        $this->table('coupon_product_channel')->removeColumn('deleted_at');

    }
}
